package com.b511.swpu.cementbackend.controller;



import com.b511.swpu.cementbackend.service.CmWkBasicService;
import com.b511.swpu.cementbackend.util.R;

import org.springframework.web.bind.annotation.*;

import java.io.PrintStream;

@RestController
@RequestMapping("/CmWkBasic")
public class CmWkBasicController {

    private final CmWkBasicService cmWkBasicService;
    public CmWkBasicController(CmWkBasicService cmWkBasicService){
        this.cmWkBasicService = cmWkBasicService;
    }

    //查询CMWEKBASUIC部分字段的信息
    @GetMapping(value = "/getCmWkBasicSomeNews/{pageNum}/{pageSize}")
    public R getCmWkBasicSomeNews(@PathVariable("pageNum") Integer pageNum,@PathVariable("pageSize")Integer pageSize,@RequestParam(value = "wellName",required = false,defaultValue = "") String wellName, @RequestParam(value = "caseSize",required = false,defaultValue = "")String caseSize){
        return cmWkBasicService.getCmWkBasicSomeNews(pageNum,pageSize,wellName,caseSize);
    }


    // 通过验证
    @PutMapping("/passValidate")
    public R passValidate(@RequestParam(value = "wellName",required = false,defaultValue = "") String wellName, @RequestParam(value = "caseSize",required = false,defaultValue = "")String caseSize,
                          @RequestParam(value = "checkPerson", required = false, defaultValue = "") String checkPerson){
        return cmWkBasicService.PassValidate(wellName,caseSize, checkPerson);
    }

    //查询 当前用户上传者 CM_WK_BASIC部分字段的全部信息
    @GetMapping(value = "/getCmWkBasicByuploadPerson/{uploadPerson}/{pageNum}/{pageSize}")
    public R getCmWkBasicByuploadPerson(@PathVariable("uploadPerson") String uploadPerson,@PathVariable("pageNum") Integer pageNum,@PathVariable("pageSize")Integer pageSize,@RequestParam(value = "wellName",required = false,defaultValue = "") String wellName, @RequestParam(value = "caseSize",required = false,defaultValue = "")String caseSize){
        System.out.println("ceshi");
        return cmWkBasicService.getCmWkBasicByuploadPerson(uploadPerson,pageNum,pageSize,wellName,caseSize);
    }

    // 查询 当前用户为校验者 CM_WK_BASIC部分字段的全部信息
    @GetMapping(value = "/getCmWkBasicByCheckPerson/{checkPerson}/{pageNum}/{pageSize}")
    public R getCmWkBasicByCheckPerson(@PathVariable("checkPerson") String checkPerson,@PathVariable("pageNum") Integer pageNum,@PathVariable("pageSize")Integer pageSize,@RequestParam(value = "wellName",required = false,defaultValue = "") String wellName, @RequestParam(value = "caseSize",required = false,defaultValue = "")String caseSize){

        return cmWkBasicService.getCmWkBasicByCheckPerson(checkPerson,pageNum,pageSize,wellName,caseSize);
    }


}
